/*
 * Copyright (c) 2011 Auzingers
 * Created by Oui-IT
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package com.auzingers.docsorganizer.entity;

import com.google.common.base.Objects;

/**
 * Class that represents a author of a google entry (name and mail).
 */
public class GoogleAuthor {

    private String name;

    private String email;

    /**
     * Initializes a new GoogleAuthor entity with the given attributes.
     * @param name name of new instance
     * @param email email of new instance
     */
    public GoogleAuthor(String name, String email) {
        this.name = name;
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public String getEmail() {
        return email;
    }

    // -------------------------------------------

    @Override
    public int hashCode() {
        return Objects.hashCode(email);
    }

    @Override
    public boolean equals(Object obj) {
        final boolean result;
        if (obj instanceof GoogleAuthor) {
            final GoogleAuthor other = (GoogleAuthor) obj;
            result = Objects.equal(email, other.email);
        } else {
            result = false;
        }
        return result;
    }
}
